package service.impl;

import Dao.SongsDao;
import Dao.impl.SongsDaoImpl;
import pojo.Songs;
import service.SongsService;

import java.util.List;

/**
 * 作者：杨晋
 */
public class SongsServiceImpl implements SongsService {
    SongsDao songsDao = (SongsDao) new SongsDaoImpl();

    // 插入歌曲
    @Override
    public boolean insert(Songs songs) {
        return songsDao.insert(songs);
    }

    // 更新歌曲
    @Override
    public boolean update(Songs songs) {
        return songsDao.update(songs);
    }

    @Override
    public List<Songs> getSongsByUploaderId(int uploaderId) {
        return songsDao.getSongsByUploaderId(uploaderId);
    }

    // 删除歌曲
    @Override
    public boolean deleteById(int songId) {
        return songsDao.deleteById(songId);
    }

    @Override
    public List<Songs> selectSongList(Integer startIndex, Integer targetTotal) {
        return songsDao.selectSongList(startIndex, targetTotal);
    }

    @Override
    public String getSongPathById(int songId) {
        return songsDao.getSongPathById(songId);
    }

    @Override
    public Integer getTotalSongCount() {
        return songsDao.selectSongList().size();
    }

    @Override
    public Songs selectSongById(int songId) {
        return songsDao.selectSongById(songId);
    }
}
